/**
 * Licensed under the MIT License
 *
 * Copyright (c) 2010 Alexandre Croiseaux
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */
package marcel.display.gui.components
{
	import flash.geom.ColorTransform;
	import marcel.display.gui.form.IFormComponent;
	import marcel.display.gui.texts.CoreField;
	
	/**
	 * A Corefield classe implementing the IFormComponent interface, to be used in forms.
	 * @author Alexandre Croiseaux
	 */
	public class Label extends CoreField implements IFormComponent
	{
		/**
		 * Return the text of the current label
		 * @return the text of the current label
		 */
		public function getValue():*
		{
			return text;
		}
		
		/**
		 * Sets the text of the current InputText and updates the graphics if needed.
		 * @param	oValue	a text string
		 */
		public function setValue(oValue:*) : void
		{
			text = oValue.toString();
		}
		
		/**
		 * Displays the current component as having an error or not. This method is automatically called by the Form class if form.useHighlight is set to true.
		 * @param	hasError	Indicates if there is an error or not.
		 */
		public function displayError(hasError:Boolean):void
		{
			if (hasError)
			{
				var ct:ColorTransform = new ColorTransform();
				ct.color = 0xFF0000;
				transform.colorTransform = ct;
			}
			else transform.colorTransform = new ColorTransform();
		}
	}
}